package com.cykj.v_m_sprintboot.serviceImpl;

import com.cykj.v_m_sprintboot.bean.TbOperator;

import com.cykj.v_m_sprintboot.mapper.TbOperatorMapper;
import com.cykj.v_m_sprintboot.service.TbOpratorService;
import org.apache.ibatis.session.RowBounds;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
/**
 * @author: wei
 * @date: 2021/9/26 20:20
 */

@Service("tbOpratorService")
public class TbOpratorServiceIml implements TbOpratorService {
    @Autowired
    private TbOperatorMapper tbOperatorMapper;

    @Override
    public List<TbOperator> findOperator(RowBounds rowBounds) {
        System.out.println("11111111111");
        return tbOperatorMapper.findOperator(rowBounds);


    }

    @Override
    public int findid() {
        return tbOperatorMapper.findid();
    }

    @Override
    public boolean delOperator(int operatorId, int warehouseStateId) {
        return tbOperatorMapper.delOperator(operatorId,warehouseStateId);
    }

    @Override
    public boolean changOperator(Integer operatorId, String operatorAccount, String operatorTime, String operatorName, Long warehouseStateId, String operatorPhone, String operatorAddress,String operatorLicence) {
        try {
            tbOperatorMapper.changOperator( operatorId,  operatorAccount, operatorTime, operatorName,  warehouseStateId,  operatorPhone, operatorAddress, operatorLicence);
        } catch (Exception e) {
            e.printStackTrace();
        }
        return true;
    }

    @Override
    public List<TbOperator> findonSelect(String operatorName ,RowBounds rowBounds) {
        return tbOperatorMapper.findonSelect(operatorName, rowBounds);
    }

    @Override
    public boolean ChangePwdOperator(int operatorId,String operatorPassword) {
        return tbOperatorMapper.ChangePwdOperator(operatorId,operatorPassword);
    }

    //运营商注册
    @Override
    public boolean insertOperter(String operatorAccount, String operatorPassword, String operatorName, String operatorPhone, String operatorAddress, String operatorLicence, String operatorTime) {
        System.out.println("impl增加的数据有：："+"账号-"+operatorAccount+"密码--"+operatorPassword+"名字--"+operatorName+"电话--"+operatorPhone+"地址--"+operatorAddress+operatorLicence+"时间"+operatorTime);
        return tbOperatorMapper.insertOperter(operatorAccount,operatorPassword,operatorName,operatorPhone,operatorAddress,operatorLicence,operatorTime);
    }

    //运营商登入
    @Override
    public List<TbOperator>   OpLogin(String operatorPhone, String operatorPassword) {
        return tbOperatorMapper.OpLogin(operatorPhone,operatorPassword);
    }

    //运营商查看是否被注册
    @Override
    public  List<TbOperator> findPhone(String operatorPhone) {
        return tbOperatorMapper.findPhone(operatorPhone);
    }


}
